﻿<Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
             x:Class="WGM_Silverlight.App"
             xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows"
             >
    <Application.Resources>
        <Color x:Key="MyLightBlue">#A8BCFF</Color>
        <Color x:Key="MyDarkBlue">#5268B3</Color>
        <Color x:Key="MyMidBlue">#8EA8FF</Color>
        <Color x:Key="MyDarkTan">#B39440</Color>
        <Color x:Key="MyPaleTan">#FFE18E</Color>
        <!-- these colours from http://www.colourlovers.com/palette/251792/octwelve -->
        <Color x:Key="TallGrass">#41803B</Color>
        <!-- dark green -->
        <Color x:Key="Mintellectual">#A7C494</Color>
        <!-- light mint green -->
        <Color x:Key="SheWalksSoft">#BCD3CD</Color>
        <!-- a pale blue -->
        <Color x:Key="NoodleLove">#F4DD83</Color>
        <!-- beige -->
        <Color x:Key="BeingBold">#923224</Color>
        <!-- deep red -->

        <SolidColorBrush x:Key="ListBoxBackgroundBrush" Color="{StaticResource Mintellectual}" />
        <SolidColorBrush x:Key="ListBoxItemBackgroundBrush" Color="{StaticResource TallGrass}" />
        <!--#51615B-->
        <SolidColorBrush x:Key="ListBoxItemForegroundBrush" Color="{StaticResource NoodleLove}" />
        <Color x:Key="ThumbForegroundColor">#8EA8FF</Color>
        <Color x:Key="ThumbHoverColor">#5268B3</Color>

        <Style 
		x:Name="ScrollBarStyle1" 
		TargetType="ScrollBar" 
		xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows">
            <!-- Any other properties you want to set -->
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="ScrollBar">
                        <Grid x:Name="Root">
                            <!-- States -->
                            <Grid.Resources>
                                <!-- RepeatButton Templates -->
                                <ControlTemplate x:Key="RepeatButtonTemplate" TargetType="RepeatButton">
                                    <Grid x:Name="Root" Background="Transparent">
                                        <vsm:VisualStateManager.VisualStateGroups>
                                            <vsm:VisualStateGroup x:Name="CommonStates">
                                                <vsm:VisualState x:Name="Normal" />
                                            </vsm:VisualStateGroup>
                                        </vsm:VisualStateManager.VisualStateGroups>
                                    </Grid>
                                </ControlTemplate>

                                <ControlTemplate x:Key="HorizontalIncrementTemplate" TargetType="RepeatButton">
                                    <Grid x:Name="Root" Background="#00000000">
                                        <vsm:VisualStateManager.VisualStateGroups>
                                            <vsm:VisualStateGroup x:Name="CommonStates">
                                                <vsm:VisualStateGroup.Transitions>
                                                    <vsm:VisualTransition To="MouseOver" GeneratedDuration="0:0:0.2" />
                                                </vsm:VisualStateGroup.Transitions>
                                                <vsm:VisualState x:Name="Normal" />
                                                <vsm:VisualState x:Name="MouseOver">
                                                    <Storyboard>
                                                        <ColorAnimation Storyboard.TargetName="ButtonColor" Storyboard.TargetProperty="Color" To="#FF557E9A" Duration="0" />
                                                    </Storyboard>
                                                </vsm:VisualState>
                                                <vsm:VisualState x:Name="Disabled">
                                                    <Storyboard>
                                                        <DoubleAnimation Storyboard.TargetName="ButtonVisual" Storyboard.TargetProperty="Opacity" To=".6" Duration="0" />
                                                    </Storyboard>
                                                </vsm:VisualState>
                                            </vsm:VisualStateGroup>
                                        </vsm:VisualStateManager.VisualStateGroups>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="35*"/>
                                            <ColumnDefinition Width="30*"/>
                                            <ColumnDefinition Width="35*"/>
                                        </Grid.ColumnDefinitions>
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="25*"/>
                                            <RowDefinition Height="50*"/>
                                            <RowDefinition Height="25*"/>
                                        </Grid.RowDefinitions>
                                        <Path x:Name="ButtonVisual" Grid.Column="1" Grid.Row="1" Stretch="Fill" Data="F1 M 511.047,352.682L 511.047,342.252L 517.145,347.467L 511.047,352.682 Z ">
                                            <Path.Fill>
                                                <SolidColorBrush x:Name="ButtonColor" Color="#FF313131" />
                                            </Path.Fill>
                                        </Path>
                                    </Grid>
                                </ControlTemplate>

                                <ControlTemplate x:Key="HorizontalDecrementTemplate" TargetType="RepeatButton">
                                    <Grid x:Name="Root" Background="#00000000">
                                        <vsm:VisualStateManager.VisualStateGroups>
                                            <vsm:VisualStateGroup x:Name="CommonStates">
                                                <vsm:VisualStateGroup.Transitions>
                                                    <vsm:VisualTransition To="MouseOver" GeneratedDuration="0:0:0.2" />
                                                </vsm:VisualStateGroup.Transitions>
                                                <vsm:VisualState x:Name="Normal" />
                                                <vsm:VisualState x:Name="MouseOver">
                                                    <Storyboard>
                                                        <ColorAnimation Storyboard.TargetName="ButtonColor" Storyboard.TargetProperty="Color" To="#FF557E9A" Duration="0" />
                                                    </Storyboard>
                                                </vsm:VisualState>
                                                <vsm:VisualState x:Name="Disabled">
                                                    <Storyboard>
                                                        <DoubleAnimation Storyboard.TargetName="ButtonVisual" Storyboard.TargetProperty="Opacity" To=".6" Duration="0" />
                                                    </Storyboard>
                                                </vsm:VisualState>
                                            </vsm:VisualStateGroup>

                                        </vsm:VisualStateManager.VisualStateGroups>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="35*"/>
                                            <ColumnDefinition Width="30*"/>
                                            <ColumnDefinition Width="35*"/>
                                        </Grid.ColumnDefinitions>
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="25*"/>
                                            <RowDefinition Height="50*"/>
                                            <RowDefinition Height="25*"/>
                                        </Grid.RowDefinitions>
                                        <Path x:Name="ButtonVisual" Grid.Column="1" Grid.Row="1" Stretch="Fill" Data="F1 M 110.692,342.252L 110.692,352.682L 104.594,347.467L 110.692,342.252 Z ">
                                            <Path.Fill>
                                                <SolidColorBrush x:Name="ButtonColor" Color="#FF313131" />
                                            </Path.Fill>
                                        </Path>
                                    </Grid>
                                </ControlTemplate>

                                <ControlTemplate x:Key="VerticalIncrementTemplate" TargetType="RepeatButton">
                                    <Grid x:Name="Root" Background="#00000000">
                                        <vsm:VisualStateManager.VisualStateGroups>
                                            <vsm:VisualStateGroup x:Name="CommonStates">
                                                <vsm:VisualStateGroup.Transitions>
                                                    <vsm:VisualTransition To="MouseOver" GeneratedDuration="0:0:0.2" />
                                                </vsm:VisualStateGroup.Transitions>
                                                <vsm:VisualState x:Name="Normal" />
                                                <vsm:VisualState x:Name="MouseOver">
                                                    <Storyboard>
                                                        <ColorAnimation Storyboard.TargetName="ButtonColor" Storyboard.TargetProperty="Color" To="#FF557E9A" Duration="0" />
                                                    </Storyboard>
                                                </vsm:VisualState>
                                                <vsm:VisualState x:Name="Disabled">
                                                    <Storyboard>
                                                        <DoubleAnimation Storyboard.TargetName="ButtonVisual" Storyboard.TargetProperty="Opacity" To=".6" Duration="0" />
                                                    </Storyboard>
                                                </vsm:VisualState>
                                            </vsm:VisualStateGroup>
                                            <vsm:VisualStateGroup x:Name="FocusStates">
                                                <vsm:VisualState x:Name="Focused">
                                                    <Storyboard>
                                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="FocusVisual" Storyboard.TargetProperty="Visibility" Duration="0">
                                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                                <DiscreteObjectKeyFrame.Value>
                                                                    <Visibility>Visible</Visibility>
                                                                </DiscreteObjectKeyFrame.Value>
                                                            </DiscreteObjectKeyFrame>
                                                        </ObjectAnimationUsingKeyFrames>
                                                    </Storyboard>
                                                </vsm:VisualState>
                                                <vsm:VisualState x:Name="Unfocused">
                                                    <Storyboard>
                                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="FocusVisual" Storyboard.TargetProperty="Visibility" Duration="0">
                                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                                <DiscreteObjectKeyFrame.Value>
                                                                    <Visibility>Collapsed</Visibility>
                                                                </DiscreteObjectKeyFrame.Value>
                                                            </DiscreteObjectKeyFrame>
                                                        </ObjectAnimationUsingKeyFrames>
                                                    </Storyboard>
                                                </vsm:VisualState>
                                            </vsm:VisualStateGroup>
                                        </vsm:VisualStateManager.VisualStateGroups>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="25*"/>
                                            <ColumnDefinition Width="50*"/>
                                            <ColumnDefinition Width="25*"/>
                                        </Grid.ColumnDefinitions>
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="35*"/>
                                            <RowDefinition Height="30*"/>
                                            <RowDefinition Height="35*"/>
                                        </Grid.RowDefinitions>
                                        <Path x:Name="ButtonVisual" Grid.Column="1" Grid.Row="1" Stretch="Fill" Data="F1 M 531.107,321.943L 541.537,321.943L 536.322,328.042L 531.107,321.943 Z ">
                                            <Path.Fill>
                                                <SolidColorBrush x:Name="ButtonColor" Color="#FF313131" />
                                            </Path.Fill>
                                        </Path>
                                        <Rectangle x:Name="FocusVisual" Grid.ColumnSpan="3" Grid.RowSpan="3"  Stroke="#666666" Fill="#00000000"  StrokeDashArray=".2 5" StrokeDashCap="Round" IsHitTestVisible="false" Opacity="0" />
                                    </Grid>
                                </ControlTemplate>

                                <ControlTemplate x:Key="VerticalDecrementTemplate" TargetType="RepeatButton">
                                    <Grid x:Name="Root" Background="#00000000">
                                        <vsm:VisualStateManager.VisualStateGroups>
                                            <vsm:VisualStateGroup x:Name="CommonStates">
                                                <vsm:VisualStateGroup.Transitions>
                                                    <vsm:VisualTransition To="MouseOver" GeneratedDuration="0:0:0.2" />
                                                </vsm:VisualStateGroup.Transitions>
                                                <vsm:VisualState x:Name="Normal" />
                                                <vsm:VisualState x:Name="MouseOver">
                                                    <Storyboard>
                                                        <ColorAnimation Storyboard.TargetName="ButtonColor" Storyboard.TargetProperty="Color" To="#FF557E9A" Duration="0" />
                                                    </Storyboard>
                                                </vsm:VisualState>
                                                <vsm:VisualState x:Name="Disabled">
                                                    <Storyboard>
                                                        <DoubleAnimation Storyboard.TargetName="ButtonVisual" Storyboard.TargetProperty="Opacity" To=".6" Duration="0" />
                                                    </Storyboard>
                                                </vsm:VisualState>
                                            </vsm:VisualStateGroup>
                                        </vsm:VisualStateManager.VisualStateGroups>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="25*"/>
                                            <ColumnDefinition Width="50*"/>
                                            <ColumnDefinition Width="25*"/>
                                        </Grid.ColumnDefinitions>
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="35*"/>
                                            <RowDefinition Height="30*"/>
                                            <RowDefinition Height="35*"/>
                                        </Grid.RowDefinitions>
                                        <Path x:Name="ButtonVisual" Grid.Column="1" Grid.Row="1" Stretch="Fill" Data="F1 M 541.537,173.589L 531.107,173.589L 536.322,167.49L 541.537,173.589 Z ">
                                            <Path.Fill>
                                                <SolidColorBrush x:Name="ButtonColor" Color="#FF313131" />
                                            </Path.Fill>
                                        </Path>
                                    </Grid>
                                </ControlTemplate>

                                <!-- Thumb Templates -->
                                <ControlTemplate x:Key="VerticalThumbTemplate" TargetType="Thumb">
                                    <Grid>
                                        <vsm:VisualStateManager.VisualStateGroups>
                                            <vsm:VisualStateGroup x:Name="CommonStates">
                                                <vsm:VisualStateGroup.Transitions>
                                                    <vsm:VisualTransition To="MouseOver" GeneratedDuration="0:0:0.1" />
                                                </vsm:VisualStateGroup.Transitions>
                                                <vsm:VisualState x:Name="Normal" />
                                                <vsm:VisualState x:Name="MouseOver">
                                                    <Storyboard>
                                                        <ColorAnimation Storyboard.TargetName="ThumbForeground" Storyboard.TargetProperty="Color" To="{StaticResource ThumbHoverColor}" Duration="0" />
                                                    </Storyboard>
                                                </vsm:VisualState>
                                                <vsm:VisualState x:Name="Disabled">
                                                    <Storyboard>
                                                        <DoubleAnimation Storyboard.TargetName="ThumbVisual" Storyboard.TargetProperty="Opacity" To=".6" Duration="0" />
                                                    </Storyboard>
                                                </vsm:VisualState>
                                            </vsm:VisualStateGroup>
                                        </vsm:VisualStateManager.VisualStateGroups>

                                        <Grid x:Name="ThumbVisual">
                                            <Rectangle x:Name="Background" Width="3"
												Margin="0,.5,0,.5"
												RadiusX="2" RadiusY="2" >
                                                <Rectangle.Fill>
                                                    <SolidColorBrush x:Name="ThumbForeground" 
														Color="{StaticResource ThumbForegroundColor}" />
                                                </Rectangle.Fill>
                                            </Rectangle>
                                        </Grid>
                                    </Grid>
                                </ControlTemplate>

                                <ControlTemplate x:Key="HorizontalThumbTemplate" TargetType="Thumb">
                                    <Grid>
                                        <vsm:VisualStateManager.VisualStateGroups>
                                            <vsm:VisualStateGroup x:Name="CommonStates">
                                                <vsm:VisualStateGroup.Transitions>
                                                    <vsm:VisualTransition To="MouseOver" GeneratedDuration="0:0:0.1" />
                                                </vsm:VisualStateGroup.Transitions>
                                                <vsm:VisualState x:Name="Normal" />
                                                <vsm:VisualState x:Name="MouseOver">
                                                    <Storyboard>
                                                        <ColorAnimation Storyboard.TargetName="ThumbForeground" Storyboard.TargetProperty="Color" To="{StaticResource ThumbHoverColor}" Duration="0" />
                                                    </Storyboard>
                                                </vsm:VisualState>
                                                <vsm:VisualState x:Name="Disabled">
                                                    <Storyboard>
                                                        <DoubleAnimation Storyboard.TargetName="ThumbVisual" Storyboard.TargetProperty="Opacity" To=".6" Duration="0" />
                                                    </Storyboard>
                                                </vsm:VisualState>
                                            </vsm:VisualStateGroup>
                                        </vsm:VisualStateManager.VisualStateGroups>
                                        <Grid x:Name="ThumbVisual">
                                            <Rectangle x:Name="Background" 
												Margin=".5,4.5,.5,4.5"
												RadiusX="5" RadiusY="5" >
                                                <Rectangle.Fill>
                                                    <SolidColorBrush x:Name="ThumbForeground" 
														Color="{StaticResource ThumbForegroundColor}" />
                                                </Rectangle.Fill>
                                            </Rectangle>
                                        </Grid>
                                    </Grid>
                                </ControlTemplate>
                            </Grid.Resources>
                            <vsm:VisualStateManager.VisualStateGroups>
                                <vsm:VisualStateGroup x:Name="CommonStates">
                                    <vsm:VisualState x:Name="Normal" />
                                    <vsm:VisualState x:Name="MouseOver" />
                                    <vsm:VisualState x:Name="Disabled">
                                        <Storyboard>
                                            <DoubleAnimation Storyboard.TargetName="Root" Storyboard.TargetProperty="Opacity" To="0.5" Duration="0" />
                                        </Storyboard>
                                    </vsm:VisualState>
                                </vsm:VisualStateGroup>
                            </vsm:VisualStateManager.VisualStateGroups>

                            <!-- Horizontal Template -->
                            <Grid x:Name="HorizontalRoot">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="*" />
                                    <ColumnDefinition Width="Auto" />
                                </Grid.ColumnDefinitions>

                                <Grid.RowDefinitions>
                                    <RowDefinition />
                                    <RowDefinition />
                                </Grid.RowDefinitions>

                                <!-- Track Layer -->
                                <Rectangle Margin="1,6,1,6" Width="2"
									Grid.RowSpan="2" Grid.Column="1"         
									Grid.ColumnSpan="3" Fill="#FF606060" 
									RadiusX="3" RadiusY="3" />

                                <!-- Repeat Buttons + Thumb -->
                                <RepeatButton x:Name="HorizontalSmallDecrease" Grid.Column="0" Grid.RowSpan="2" Width="16" IsTabStop="False" Interval="50" Template="{StaticResource HorizontalDecrementTemplate}" />
                                <RepeatButton x:Name="HorizontalLargeDecrease" Grid.Column="1" Grid.RowSpan="2" Width="0" Template="{StaticResource RepeatButtonTemplate}" Interval="50" IsTabStop="False" />
                                <Thumb x:Name="HorizontalThumb" MinWidth="10" Width="20" Grid.Column="2" Grid.RowSpan="2" Template="{StaticResource HorizontalThumbTemplate}" />
                                <RepeatButton x:Name="HorizontalLargeIncrease" Grid.Column="3" Grid.RowSpan="2" Template="{StaticResource RepeatButtonTemplate}" Interval="50" IsTabStop="False" />
                                <RepeatButton x:Name="HorizontalSmallIncrease" Grid.Column="4" Grid.RowSpan="2" Width="16" IsTabStop="False" Interval="50" Template="{StaticResource HorizontalIncrementTemplate}" />
                            </Grid>

                            <!-- Vertical Template -->
                            <Grid x:Name="VerticalRoot" Visibility="Collapsed">
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition Height="*" />
                                    <RowDefinition Height="Auto" />
                                </Grid.RowDefinitions>

                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition />
                                    <ColumnDefinition />
                                </Grid.ColumnDefinitions>

                                <!-- Track Layer -->
                                <Rectangle Margin="6,1,6,1" Width="1"
							      Grid.ColumnSpan="2" Grid.Row="1"         
							      Grid.RowSpan="3" Fill="#FF606060" 
							      RadiusX="3" RadiusY="3" />


                                <!-- Repeat Buttons + Thumb -->
                                <RepeatButton x:Name="VerticalSmallDecrease" Grid.Row="0" Grid.ColumnSpan="2" Height="16" IsTabStop="False" Interval="50" Template="{StaticResource VerticalDecrementTemplate}" />
                                <RepeatButton x:Name="VerticalLargeDecrease" Grid.Row="1" Grid.ColumnSpan="2" Height="0" Template="{StaticResource RepeatButtonTemplate}" Interval="50" IsTabStop="False" />
                                <Thumb x:Name="VerticalThumb" MinHeight="10" Height="20" Grid.Row="2" Grid.ColumnSpan="2" Template="{StaticResource VerticalThumbTemplate}" />
                                <RepeatButton x:Name="VerticalLargeIncrease" Grid.Row="3" Grid.ColumnSpan="2" Template="{StaticResource RepeatButtonTemplate}" Interval="50" IsTabStop="False" />
                                <RepeatButton x:Name="VerticalSmallIncrease" Grid.Row="4" Grid.ColumnSpan="2" Height="16" IsTabStop="False" Interval="50" Template="{StaticResource VerticalIncrementTemplate}" />
                            </Grid>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>


        <Style TargetType="ScrollViewer" x:Key="ScrollViewerStyle1">
            <Setter Property="IsEnabled" Value="true" />
            <Setter Property="Foreground" Value="#FF000000" />
            <Setter Property="BorderBrush" Value="#FFA4A4A4" />
            <Setter Property="BorderThickness" Value="1" />
            <Setter Property="HorizontalContentAlignment" Value="Left" />
            <Setter Property="VerticalContentAlignment" Value="Top" />
            <Setter Property="Cursor" Value="Arrow" />
            <!--<Setter Property="TextAlignment" Value="Left" />-->
            <!--<Setter Property="TextWrapping" Value="NoWrap" />-->
            <!-- Cannot currently parse FontFamily type in XAML so it's being set in code -->
            <!-- <Setter Property="FontFamily" Value="Trebuchet MS" /> -->
            <Setter Property="FontSize" Value="11" />
            <Setter Property="VerticalScrollBarVisibility" Value="Visible" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="ScrollViewer">
                        <Grid Background="{TemplateBinding Background}">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="Auto"/>
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="*"/>
                                <RowDefinition Height="Auto"/>
                            </Grid.RowDefinitions>
                            <!-- Fill="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" -->
                            <ScrollContentPresenter
                              x:Name="ScrollContentPresenter"
                              Grid.Column="0"
                              Grid.Row="0"
                              Content="{TemplateBinding Content}"
                              ContentTemplate="{TemplateBinding ContentTemplate}"
                              Cursor="{TemplateBinding Cursor}"
                              Margin="{TemplateBinding Padding}" />
                            <ScrollBar
                              x:Name="VerticalScrollBar"
							  Style="{StaticResource ScrollBarStyle1}"
                              Grid.Column="1"
                              Grid.Row="0"
                              Orientation="Vertical"
                              Cursor="Arrow"
                              Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}"
                              ViewportSize="{TemplateBinding ViewportHeight}"
                              Minimum="0"
                              Maximum="{TemplateBinding ScrollableHeight}"
                              Value="{TemplateBinding VerticalOffset}" 
                              Width="18"/>
                            <ScrollBar
                              x:Name="HorizontalScrollBar"
                              Style="{StaticResource ScrollBarStyle1}"
							  Grid.Column="0"
                              Grid.Row="1"
                              Orientation="Horizontal"
                              Cursor="Arrow"
                              Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}"
                              ViewportSize="{TemplateBinding ViewportWidth}"
                              Minimum="0"
                              Maximum="{TemplateBinding ScrollableWidth}"
                              Value="{TemplateBinding HorizontalOffset}" 
                              Height="18"/>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>



        <Style x:Key="ListBoxItemStyle1" TargetType="ListBoxItem"
			xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows">
            <Setter Property="Foreground" 
			   Value="{StaticResource ListBoxItemForegroundBrush}" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="ListBoxItem">
                        <Grid x:Name="Root">
                            <vsm:VisualStateManager.VisualStateGroups>
                                <vsm:VisualStateGroup x:Name="SelectionStates">
                                    <vsm:VisualState x:Name="Unselected" />
                                    <vsm:VisualState x:Name="Selected">
                                        <Storyboard>
                                            <DoubleAnimation 
										 Storyboard.TargetName="SelectedBorderBackgroundBrush" 
										 Storyboard.TargetProperty="Opacity" 
										 Duration="0" 
										 To="1.0"/>
                                            <ColorAnimation 
										Storyboard.TargetName="SelectedBorderBackgroundBrush" 
										Storyboard.TargetProperty="Color" 
										Duration="0" 
										To="#FF397F8F"/>
                                        </Storyboard>
                                    </vsm:VisualState>
                                </vsm:VisualStateGroup>
                                <vsm:VisualStateGroup x:Name="CommonStates">
                                    <vsm:VisualState x:Name="Normal" />
                                    <vsm:VisualState x:Name="MouseOver">
                                        <Storyboard>
                                            <ColorAnimation 
										  Storyboard.TargetName="HoverBorderBackgroundBrush" 
										  Storyboard.TargetProperty="Color" 
										  Duration="0" 
										  To="#898A8A"/>
                                        </Storyboard>
                                    </vsm:VisualState>
                                </vsm:VisualStateGroup>

                            </vsm:VisualStateManager.VisualStateGroups>

                            <Border CornerRadius="5" Margin="1" 
							  x:Name="HoverBorder">
                                <Border.Background>
                                    <SolidColorBrush 
									x:Name="HoverBorderBackgroundBrush" 
									Color="#51615B" />
                                </Border.Background>
                            </Border>
                            <Border CornerRadius="5" Margin="1" 
							  x:Name="SelectedBorder">
                                <Border.Background>
                                    <SolidColorBrush 
									x:Name="SelectedBorderBackgroundBrush" 
									Opacity="0"
									Color="#397F8F" />
                                </Border.Background>
                            </Border>
                            <ContentPresenter
							    Margin="4,1"														
							    Content="{TemplateBinding Content}" />
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <Style x:Key="ListBoxStyle1" TargetType="ListBox">
            <Setter Property="ItemContainerStyle" Value="{StaticResource ListBoxItemStyle1}" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="ListBox">
                        <Grid x:Name="Root">
                            <Border Padding="3" Background="{StaticResource ListBoxBackgroundBrush}" CornerRadius="5">
                                <ScrollViewer x:Name="ScrollViewer" 
								Style="{StaticResource ScrollViewerStyle1}"
								Padding="{TemplateBinding Padding}">
                                    <ItemsPresenter />
                                </ScrollViewer>
                            </Border>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

    </Application.Resources>
</Application>
